<%@include file="/page/tag.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<!--框架必需start-->
<script type="text/javascript" src="${ctp}/QUI/libs/js/jquery.js"></script>
<script type="text/javascript" src="${ctp}/QUI/libs/js/language/cn.js"></script>
<script type="text/javascript" src="${ctp}/QUI/libs/js/framework.js"></script>
<link href="${ctp}/QUI/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
<link href="${ctp}/QUI/libs/skins/lightBlue/style.css" rel="stylesheet" type="text/css" id="theme" themeColor="lightBlue"/>
<!--框架必需end-->

<!--数据表格start-->
<script src="${ctp}/QUI/libs/js/table/quiGrid.js" type="text/javascript"></script>
<!--数据表格end-->

<!--箭头分页start-->
<script type="text/javascript" src="${ctp}/QUI/libs/js/nav/pageArrow.js"></script>
<!--箭头分页end-->

<!--树组件start -->
<script type="text/javascript" src="${ctp}/QUI/libs/js/tree/ztree/ztree.js"></script>
<link href="${ctp}/QUI/libs/js/tree/ztree/ztree.css" rel="stylesheet" type="text/css"/>
<!--树组件end -->

<!-- 日期选择框start -->
<script type="text/javascript" src="${ctp}/QUI/libs/js/form/datePicker/WdatePicker.js"></script>
<!-- 日期选择框end -->

<style>
.right_border{
	border-right: 1px solid;
}
</style>
</head>
<body style="background-color:#ffffff;">

<div class="box2" panelTitle="条件查询" id="searchPanel" startState="open">
	<form id="searchF">
		<input type="hidden" name="pageNo" value="1"/>
		<input type="hidden" name="pageSize" value="20"/>
		<input id="h_orderBy" type="hidden" name="orderBy" value="createTime"/>
		<input id="h_order" type="hidden" name="order" value="desc"/>
		
		<table class="tableStyle" >
			<tr>
				<td>
					仓库:
				</td>
				<td colspan="">
					<select name="filter_EQS_erpStorage.erpStorageId" url="${ctp}/erpStorage/erpStorage_select_list.do" prompt="全部"></select>
				</td>
				
				<td>
					类型:
				</td>
				<td colspan="">
					<select name="filter_EQS_storageFlowType" prompt="全部">
						<option value="">全部</option>
						<option value="${StateValue.InStorage_key }">${StateValue.InStorage_value }</option>
						<option value="${StateValue.OutStorage_key }">${StateValue.OutStorage_value }</option>
					</select>
				</td>
				
			</tr>
			
			<tr>
				<td>
					时间:
				</td>
				<td>
					<input type="text" class="date" style="width: 25%;" name="filter_GED_createTime"/>
					&nbsp;至&nbsp;
					<input type="text" class="date" style="width: 25%;" name="filter_LED_createTime"/>
				</td>
				
				<td colspan="2" style="text-align: center;">
					<input type="button" value="查询" onclick="searchFF()" />
					<input type="button" value="刷新" onclick="reflushList()" />
				</td>
			</tr>
			
		</table>
	</form>
</div> 

<div class="padding_right5">
	<div id="maingrid">
    </div>
</div>	

<div id="pageContent" style="height:35px;"></div> 	

<script type="text/javascript" src="${ctp}/js/list.js"></script>
<script type="text/javascript" src="${ctp}/js/httpUtil.js"></script> 
<script type="text/javascript" src="${ctp}/js/dateUtil.js"></script> 
<script type="text/javascript">
var g_pageNo = 1;
var g_pageSize = 20;
//数据表格使用
var g;
var gridData;
function initComplete(){
	g = $("#maingrid").quiGrid({
		columns: [ 
		          { display: 'id', isAllowHide: false, name: 'storageFlowId',hide:true },
		          { display: '仓库',  name: 'erpStorage.storageName',  isAllowHide: false,   align: 'center',  width:"25%" },
		          { display: '总价',  name: 'storageFlowTotalPrice',  isAllowHide: false,   align: 'center',  width:"25%" },
		          { display: '类型',  name: 'storageFlowType',  isAllowHide: false,   align: 'center',  width:"10%" , 
		        	  render: function (rowdata, rowindex, value, column){
		        	  if(rowdata.storageFlowType == "${StateValue.InStorage_key }"){
		        		  return "入库";
		        	  } else{
		        		  return "出库";
		        	  }
		         	 }
		          },
		          { display: '创建时间', name: 'createTime', isAllowHide: false, align: 'center',  width:"15%", type:"date" },
		          { display: '操作', isAllowHide: false, align: 'center',  width:"10%", render: function (rowdata, rowindex, value, column){
					  return '<div class="padding_top4 padding_left5">'
					  + '<span class="img_view hand" title="查看" onclick="onView(\'' + rowdata.storageFlowId+ '\')"></span>' 
					  /* + '<span class="img_edit hand" title="编辑" onclick="onEdit(\'' + rowdata.erpGoodInfoId+ '\')"></span>' 
					  + '<span class="img_delete hand" title="删除" onclick="onDel(\'' + rowdata.erpGoodInfoId+ '\')"></span>'  */
					  + '</div>';
					}
				  }
		          ], 
		          data:[],
		          sortName: 'sortIndex',
		          sortOrder: 'desc',
		          rownumbers:true,
		          percentWidthMode:true,
		          dataAction:'dataAction',
		          enabledSort:true,
		          checkbox:false,
		          usePager: false,
		          height: '95%',
		          width:"100%",
		          frozen:false,
		          toolbar:{
		        	  items:[
		        	         {text: '入库', click: addColumn,    iconClass: 'icon_add'},
		        	         {text: '出库', click: addColumn1,    iconClass: 'icon_add'}
		        	         ]
		          }, 
		          onChangeSort : function(){
		        	  $("#h_orderBy").val(g.options.sortName);
		        	  $("#h_order").val(g.options.sortOrder);
		        	  var data = $("#searchF").serialize();
		        	  getData(g.options.url, data);
		        	  return false;
		          },
		          onDblClickRow:function(rowdata, rowindex, rowDomElement){
		        	  onView(rowdata.storageFlowId);
		          }
	});
}

$.quiDefaults.Grid.formatters['date'] = function (value, column) {
	return dateFormat.format(new Date(value), DateFormat.DEFAULT_DATETIME_FORMAT);
}


$(function(){
	g.options.url = "${ctp}/erpStorageFlow/erpStorageFlow_list.do";
	g.options.data = {	
			"pageNo": g_pageNo,
			"pageSize": g_pageSize,
			"orderBy": "createTime",
			"order": "asc"
	};
	g.options.data.a = 1;
	getData(g.options.url, g.options.data);
});

//新增
function addColumn(){
	top.Dialog.open({
		URL:"${ctp}/erpStorageFlow/erpStorageFlow_edit.html",
		Title:"入库",
		Width:800,
		Height:450
	});
}

//新增
function addColumn1(){
	top.Dialog.open({
		URL:"${ctp}/erpStorageFlow/erpStorageFlow_out.html",
		Title:"出库",
		Width:800,
		Height:450
	});
}


//更新
function onEdit(id){
	top.Dialog.open({
		URL:"${ctp}/erpStorageFlow/erpStorageFlow_edit.html?id=" + id ,
		Title:"更新",
		Width:800,
		Height:450
	});
}

//查看
function onView(id){
	top.Dialog.open({
		URL:"${ctp}/erpStorageFlow/erpStorageFlow_detail_" + id + ".html",
		Title:"查看",
		Width:800,
		Height:450
	});
}

function onDel(id){
	top.Dialog.confirm("是否确定删除？",
			function(){
				$.ajax({
					url:"${ctp}/erpGoodInfo/erpGoodInfo_del_" + id + ".do",
					success:function(data){
						if(data.result){
							top.frmright.reflushList();
							top.Dialog.alert(data.msg, null, null, null, 2);
						} else{
							top.Dialog.alert(data.msg, null, null, null, 2);
						}
					}
				});
			},
			function(){top.Dialog.close();});
}

function searchFF(){
	var data = $("#searchF").serialize();
	getData(g.options.url, data);
}

</script> 
</body>
</html>
